﻿using AnQinFrameWorkAPI.Entity.Develop.DTO.DevelopProjectDevelopment;
using AnQinFrameWorkAPI.Entity.Develop.View.DevelopProjectDevelopment;
using AnQinFrameWorkAPI.Service.Develop;
using FrameWork.Entity;
using Microsoft.AspNetCore.Mvc;

namespace AnQinFrameWorkAPI.Controllers.Develop;

/// <summary>
///     开发管理项目开发
/// </summary>
[Route("api/[controller]")]
[ApiController]
[ApiExplorerSettings(GroupName = "Develop")]
public class DevelopProjectDevelopmentController : ControllerBase
{
    //业务服务接口
    private readonly DevelopProjectDevelopmentService _developProjectDevelopmentService;

    //构造注入
    public DevelopProjectDevelopmentController(DevelopProjectDevelopmentService developProjectDevelopmentService)
    {
        _developProjectDevelopmentService = developProjectDevelopmentService;
    }

    /// <summary>
    ///     获取开发管理项目开发列表
    /// </summary>
    /// <param name="developProjectDevelopmentSearch"></param>
    [ProducesResponseType(typeof(DevelopProjectDevelopmentView), 200)]
    [HttpGet]
    public async Task<IActionResult> GetProjectDevelopment(
        [FromQuery] DevelopProjectDevelopmentSearchDTO developProjectDevelopmentSearch)
    {
        var response = await _developProjectDevelopmentService.GetProjectDevelopment(developProjectDevelopmentSearch);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目开发 - 确认需求
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("ConfirmMulti")]
    public async Task<IActionResult> ConfirmArrayDevelopProjectDevelopment([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectDevelopmentService.ConfirmArrayDevelopProjectDevelopment(idArrayDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目开发 - 开始开发
    /// </summary>
    /// <param name="singleIdDTO"></param>
    [HttpPost("Start")]
    public async Task<IActionResult> StartDevelopProjectDevelopment([FromBody] SingleIdDTO singleIdDTO)
    {
        var response = await _developProjectDevelopmentService.StartDevelopProjectDevelopment(singleIdDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目开发 - 开发完成
    /// </summary>
    /// <param name="singleIdDTO"></param>
    [HttpPost("Finish")]
    public async Task<IActionResult> FinishDevelopProjectDevelopment([FromBody] SingleIdDTO singleIdDTO)
    {
        var response = await _developProjectDevelopmentService.FinishDevelopProjectDevelopment(singleIdDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目开发 - 取消
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("CancelMulti")]
    public async Task<IActionResult> CancelArrayDevelopProjectDevelopment([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectDevelopmentService.CancelArrayDevelopProjectDevelopment(idArrayDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     获取开发管理项目需求开发列表
    /// </summary>
    /// <param name="developProjectDemandDevelopmentSearch"></param>
    [ProducesResponseType(typeof(DevelopProjectDemandDevelopmentView), 200)]
    [HttpGet("Demand")]
    public async Task<IActionResult> GetProjectDevelopmentDemand(
        [FromQuery] DevelopProjectDemandDevelopmentSearchDTO developProjectDemandDevelopmentSearch)
    {
        var response =
            await _developProjectDevelopmentService.GetProjectDevelopmentDemand(developProjectDemandDevelopmentSearch);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目需求开发 - 确认需求
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("Demand/ConfirmMulti")]
    public async Task<IActionResult> ConfirmArrayDevelopProjectDemandDevelopment([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectDevelopmentService.ConfirmArrayDevelopProjectDemandDevelopment(idArrayDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目需求开发 - 开始开发
    /// </summary>
    /// <param name="singleIdDTO"></param>
    [HttpPost("Demand/Start")]
    public async Task<IActionResult> StartDevelopProjectDemandDevelopment([FromBody] SingleIdDTO singleIdDTO)
    {
        var response = await _developProjectDevelopmentService.StartDevelopProjectDemandDevelopment(singleIdDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目需求开发 - 开发完成
    /// </summary>
    /// <param name="singleIdDTO"></param>
    [HttpPost("Demand/Finish")]
    public async Task<IActionResult> FinishDevelopProjectDemandDevelopment([FromBody] SingleIdDTO singleIdDTO)
    {
        var response = await _developProjectDevelopmentService.FinishDevelopProjectDemandDevelopment(singleIdDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目需求开发 - 取消
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("Demand/CancelMulti")]
    public async Task<IActionResult> CancelArrayDevelopProjectDemandDevelopment([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectDevelopmentService.CancelArrayDevelopProjectDemandDevelopment(idArrayDTO);
        return StatusCode(response.Status, response);
    }
}